import request from "@/utils/request"

import type { TrademarkListDataModel, TrademarkMode } from "./model/trademark"

enum Api {
  getAllTrademarkListApi = "/admin/product/baseTrademark",
  saveTrademarkApi = "/admin/product/baseTrademark/save",
  deleteTrademarkApi = "/admin/product/baseTrademark/remove",
  updateTrademarkApi = "/admin/product/baseTrademark/update",
}

// 1.获取品牌管理页数据
export const reqGetTrademarkListData = (page: number, limit: number) =>
  request.get<any, TrademarkListDataModel>(
    `${Api.getAllTrademarkListApi}/${page}/${limit}`
  )
// 2.添加品牌
export const reqSaveTrademarkInfo = (trademark: TrademarkMode) =>
  request.post<any, null>(Api.saveTrademarkApi, trademark)

// 3.删除品牌
export const reqDeleteTrademarkInfo = (id: number) =>
  request.delete<any, null>(`${Api.deleteTrademarkApi}/${id}`)

// 4.编辑品牌
export const reqUpdateTrademarkInfo = (trademark: TrademarkMode) =>
  request.put<any, null>(Api.updateTrademarkApi, trademark)
